Updating the Data Source
Overview
In this step we are going to adjust the previously defined Data Source which had a hard coded movie year of 2014 and make it more flexible using a variable placeholder.
Walkthrough Definition
Opening the Data Source
Access the Data Source Designer as before.
To quickly access your recent Data Source components click the icon noted below.
Choose the desired Data Source.
Click
Edit the Query
Change the query from
db.movies.find( { year: 2014}, {rated: 1, title:1, runtime: 1, awards: 1, cast: 1} )
.sort( { "awards.wins" :-1} ).limit(25)
to
db.movies.find( { year: [! @year !] }, {rated: 1, title:1, runtime: 1, awards: 1, cast: 1} )
.sort( { "awards.wins" :-1} ).limit(25)
Run the data source by clicking . The placeholder will be recognized and a prompt will be shown.
Enter a year and click OK.
The query is run with the variable replacing the placeholder. Sample results are shown below.
Open the properties dialog by clicking .
Activate the Prompt tab.
From the drop down choose
Access your recent prompts by clicking .
Choose the prompt shown below.
Click to close the catalog dialog.
Click to close the properties dialog.
Run the data source by clicking . The prompt will be shown for input.
Interact with the slider to indicate the year of interest.
Close the dialog by clicking
Sample results are shown below.
Note that prompts can be cached.To run with a clear cache press the control key down when clicking the run icon.
Save the Updated Component
Save the Data Source by clicking